#ifndef CCHATSESSION_H
#define CCHATSESSION_H

#include <QObject>
#include <QTcpSocket>
class CHandler;
class CChatServer;
class CChatSession : public QObject
{
    Q_OBJECT
public:
    explicit CChatSession(CChatServer *cs,QTcpSocket*s,QObject *parent = nullptr);
    void shunt(CHandler*room);
    void collectIncomingData(QByteArray bytes);
    void foundTerminator();
    void handleClose();
    void push(QByteArray bytes);
signals:

public slots:
    void onReadyRead();
public:
    CChatServer*server;
    QByteArray data;
    QByteArray terminator;
    QByteArray name;
    QTcpSocket* socket;
    QByteArray cmd;
    CHandler*room;
};

#endif // CCHATSESSION_H
